package com.chenshu.mobile_test.common;

import java.util.HashMap;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2024-05-08
 * Time：09:19
 */
public class MyResponse {
    public static HashMap<String, Object> success(Object data, String msg) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", 200);
        result.put("data", data);
        result.put("msg", msg);
        return result;
    }
    public static HashMap<String, Object> success(Object data) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", 200);
        result.put("data", data);
        return result;
    }

    public static HashMap<String, Object> fail(String msg) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", -1);
        result.put("msg", msg);
        return result;
    }
    public static HashMap<String, Object> fail(int code, String msg) {
        HashMap<String, Object> result = new HashMap<>();
        result.put("code", code);
        result.put("msg", msg);
        return result;
    }
}
